<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018\9\25 0025
 * Time: 10:20
 */

namespace app\validate;


use think\Validate;

class AdminConfigValidate extends  Validate
{
    protected $rule = [
        'id'                    =>'require|number',
        'variable'              =>'require|alpha',
        'keys_val'              =>'require',
        'status'                =>'in:0,1',
        'remark'                =>'require',
        'title'                 =>'require',
        'group'                 =>'require|alpha',
        'type'                  =>'require|alpha',
        'sort'                  =>'require|number',
        'create_uid'            =>'require|number',
        'create_time'           =>'require|number',
        'update_uid'            =>'require|number',
        'update_time'           =>'require|number',
    ];

    protected $message =[
        'id.require'            =>'获取修改信息错误_empty',
        'id.number'             =>'获取修改信息错误_notNumber',
        'variable.require'      =>'变量名称必须填写出',
        'variable.alpha'        =>'变量名称必须为英文',
        'keys_val.require'      =>'变量值必须填写',
        'status.in:0,1'         =>'状态赋值错误_notIn',
        'remark.require'        =>'注释信息必须填写',
        'title.require'         =>'配置名称必须填写',
        'group.require'         =>'配置分组必须填写',
        'group.alpha'           =>'配置分组必须为英文',
        'type.require'          =>'配置类型必须填写',
        'type.alpha'            =>'配置类型必须为英文',
        'sort.require'          =>'排序必须填写',
        'sort.number'           =>'排序必须为数字',
        'create_uid.require'    =>'添加人获取失败_empty',
        'create_uid.number'     =>'添加人类型错误_notNumber',
        'create_time.require'   =>'添加时间获取失败_empty',
        'create_time.number'    =>'添加时间类型错误_notNumber',
        'update_uid.require'    =>'修改人获取失败_empty',
        'update_uid.number'     =>'修改人类型错误_notNumber',
        'update_time.require'   =>'修改时间获取失败_empty',
        'update_time.number'    =>'修改时间类型错误_notNumber',
    ];

    protected $scene =[
        'add'=>[
            'variable',
            'keys_val',
            'status',
            'remark',
            'title',
            'group',
            'type',
            'sort',
            'create_uid',
            'create_time',
        ],
        'editRole'=>[
            'id',
            'variable',
            'keys_val',
            'status',
            'remark',
            'title',
            'group',
            'type',
            'sort',
            'update_uid',
            'update_time',
        ]
    ];
}